package com.alien.smartmusicplayer.textproject;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.Log;

/**
 * Created by Alien_yuan on 2015/11/23.
 */
public class ScreenLockBroadCastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d("alien", "ScreenLockBroadCastReceiver:onReceive-" + intent.getAction());
        Intent lockScreen = new Intent();
        lockScreen.setClass(context,LockScreenView.class);
        lockScreen.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        context.startActivity(lockScreen);
    }

    public static IntentFilter getIntentFilter(){
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
        intentFilter.setPriority(1000);
        return intentFilter;
    }
}
